/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.javacommunity.model.dao;

import com.javacommunity.model.entity.Post;
import com.javacommunity.model.entity.User;
import com.javacommunity.model.entity.UserPost;

/**
 *
 * @author Cong Pham Dinh
 */
public interface PostVotationDAO {

    /**
     *
     * @param user user
     * @param post post
     * @return true if user voted current post else return false
     */
    boolean isVote(User user, Post post);

    UserPost getUserPostByUP(User user, Post post);
    
    /**
     *
     * @param up
     * @return true if voted up successful post else return false
     */
    boolean updateVote(UserPost up);

    /**
     *
     * @param up
     * @return true if voted down successful post else return false
     */
    boolean createVote(UserPost up);

    /**
     *
     * @param post
     * @return vote up - vote down
     */
    int countVotation(Post post);
}
